const VUE_APP_API_URL = '/api';
class Http {
  request(type, uri, para) {
    let root = this;
    let promise = new Promise(function (resolve, reject) {
      uni.request({
        url: `${VUE_APP_API_URL}/${uri}`,
        data: para,
        header: {
			
		},
        dataType: 'json',
        method: type,
        success: function (res) {
          resolve(res);
        },
        fail: function (res) {
			console.log('fail',fail)
		}
      })
    })
    return promise;
  }
  get(url, para) {
    return this.request('get', url, para);
  }
  put(url, para) {
    return this.request('put', url, para);
  }
  post(url, para) {
    return this.request('post', url, para);
  }
  delete(url, para) {
    return this.request('delete', url, para);
  }
}
export default new Http();